home *** CD-ROM | disk | FTP | other *** search
- Path: newshost.lanl.gov!tanmoy
- From: tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya)
- Newsgroups: comp.lang.c
- Subject: Re: Help !!!!! on 'strstr"
- Date: 13 Mar 1996 16:07:28 GMT
- Organization: Los Alamos National Laboratory
- Distribution: world
- Message-ID: <TANMOY.96Mar13090728@qcd.lanl.gov>
- References: <314703FF.4045@msmail.st.stems.com>
- <Pine.A32.3.91.960312195354.119955C-100000@black.weeg.uiowa.edu>
- NNTP-Posting-Host: qcd.lanl.gov
- Mime-Version: 1.0
- Content-Type: text
- In-reply-to: The Amorphous Mass's message of Tue, 12 Mar 1996 19:57:12 -0600
-
- In article <Pine.A32.3.91.960312195354.119955C-100000@black.weeg.uiowa.edu>
- The Amorphous Mass <robinson@blue.weeg.uiowa.edu> writes:
- <snip>
- TAM: No, but you can write your own strstr() (case-sensitive) and then when
- TAM: you have it working then change the character-to-character comparison
- TAM: from, say c1 == c2 to toupper(c1) == toupper(c2). I did this recently to
- TAM: write a case-insensitive strncmp(). [tolower() will also work, of course].
- TAM: toupper() and tolower() are in <ctype.h>.
-
- Significant points to be mentioned: the function name should not start
- with str followed by lower case letter, and the c1 and c2 above must
- be unsigned chars.
-
- On a side issue, is anybody aware of a real locale where, given
- unsigned chars c1 and c2,
-
- (toupper(c1) == toupper(c2)) || (tolower(c1) == tolower(c2))
-
- is better than
-
- toupper(c1) == toupper(c2)
-
- ? (I am reasonably sure that I do not want to check whether
- toupper(tolower(x))'s match, but I always wondered about this one.)
-
- Cheers
- Tanmoy
- --
- tanmoy@qcd.lanl.gov(128.165.23.46) DECNET: BETA::"tanmoy@lanl.gov"(1.218=1242)
- Tanmoy Bhattacharya O:T-8(MS B285)LANL,NM87545 H:#9,3000,Trinity Drive,NM87544
- Others see <gopher://yaleinfo.yale.edu:7700/00/Internet-People/internet-mail>,
- <http://alpha.acast.nova.edu/cgi-bin/inmgq.pl>or<ftp://csd4.csd.uwm.edu/pub/
- internetwork-mail-guide>. -- <http://nqcd.lanl.gov/people/tanmoy/tanmoy.html>
- fax: 1 (505) 665 3003 voice: 1 (505) 665 4733 [ Home: 1 (505) 662 5596 ]
-